package com.jt.tenant.activity;

import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

import com.jt.tenant.R;

/**
 * Created by Administrator on 2016/4/25.
 */
public class AgreementActivity extends JTActivity {

    private TextView title_name;

    private WebView webView;

    private String title= "",flag = "",url = "";

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_agreement);

        title_name = (TextView) findViewById(R.id.tv_title_name);

        webView = (WebView)findViewById(R.id.wv_agreement);

        webView.getSettings().setSupportZoom(true);

        webView.getSettings().setJavaScriptEnabled(true);

        webView.getSettings().setDomStorageEnabled(true);

        webView.setWebViewClient(new WebViewClient() {

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {

                view.loadUrl(url);

                return true;

            }

        });

        title = getIntent().getStringExtra("title");

        flag = getIntent().getStringExtra("id");

        if(getIntent().getStringExtra("url") != null) {

            url = getIntent().getStringExtra("url");

        }else {

            url = "A";

        }

        if(!title.equals("")||title!=null){

            title_name.setText(title);

        }else {

            title_name.setText("简途");

        }

        initView(flag,url);

    }

    private void initView(String id,String url){

        switch (id){

            case "0":

                webView.loadUrl(url);

                break;

            case "1":
//                用户协议



                break;

            case "2":
//                简途安全驾驶奖励计划

                webView.loadUrl("http://jtbox.com/BCB/html/plan.html");

                break;

            case "3":
//                常见问题

                webView.loadUrl("http://jtbox.com/BCB/html/questions.html");

                break;

            case "4":
                //如何获取积分

                webView.loadUrl("http://www.jtbox.com/BCB/html/jf_rule_explain.html");


                break;


            case "5":


                break;


            case "6":


                break;


            case "7":


                break;


            case "8":


                break;


            default:

                break;



        }


    }




}
